import dbus
import dbus.glib
import gobject

bus = dbus.SessionBus()
rbshellobj = bus.get_object("org.gnome.Rhythmbox", "/org/gnome/Rhythmbox/Shell")
rbshell = dbus.Interface(rbshellobj, "org.gnome.Rhythmbox.Shell")
rbplayerobj = bus.get_object("org.gnome.Rhythmbox",
		"/org/gnome/Rhythmbox/Player")
rbplayer = dbus.Interface(rbplayerobj, "org.gnome.Rhythmbox.Player")

def playing_uri_changed(uri):
	rbshell.loadURI("file:///home/nax/Musik/Sonata%20Arctica/Winterheart's%20Guild/03%20-%20The%20Cage.mp3", 1)
	print "Now playing: %s" % (uri,)
	props = rbshell.getSongProperties(uri)
	interesting = ["title", "artist", "album", "location"]
	for prop in props:
		if prop in interesting:
			print "%s: %s" % (prop, props[prop])

rbplayer.connect_to_signal("playingUriChanged", playing_uri_changed)

loop = gobject.MainLoop()
loop.run()
